package com.basker.pisces.redis.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 提供默认的Redisson组件
 *
 * @author hangwen
 */
@Configuration
@ConditionalOnClass(Redisson.class)
public class RedissonClientConfiguratiuon {

    @Bean
    @ConditionalOnMissingBean(name = "redissonClient")
    public RedissonClient redissonClient(Config config) {
        return Redisson.create(config);
    }

}
